/*
 *  Copyright (C) 2011 Hatsites
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package org.myorg.ctm.etk.gui.swg.display.create.item.clt.panel;

import org.myorg.ctm.etk.dtb.structure.dtb.tbl.TblClt;
import org.myorg.ctm.etk.gui.swg.display.create.PnlAdressePostale;
import org.myorg.ctm.etk.gui.swg.display.create.PnlIdtHmn;
import org.myorg.ctm.etk.gui.swg.display.create.item.panel.PnlEmail;
import org.myorg.ctm.etk.gui.swg.display.create.panel.PnlNewAbs;

/**
 *
 * @author Hatsites
 *
 * email: Hatsites_AT_gmail.com
 * ... please remove "_AT_" from the above string to get the right email address
 */

public class PnlNewItmClt extends PnlNewAbs{
    public PnlNewItmClt(){
        this._pnlId_ = new PnlIdtHmn();
        this._pnlAdr_ = new PnlAdressePostale();
        this._pnlEml_ = new PnlEmail();
        
    }
    public boolean init() {
        if(!this._pnlEml_.init()){
            return false;
        }
        if (!this._pnlId_.init()){
            return false;
        }
        if(!this._pnlAdr_.init()){
            return false;
        }


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(_pnlId_)
                .addComponent(_pnlAdr_)
                .addComponent(_pnlEml_)
            )
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup()
                .addComponent(this._pnlId_)
                .addComponent(this._pnlAdr_)
                .addComponent(this._pnlEml_)
            )
        );
        return true;
    }

    public void destroy() {
        return;
    }

    public void writeUserInputs(){
        TblClt.s_getInstance().setValue(TblClt.STR_IDT_NOM,
                this._pnlId_.getIdentiteNom());

        TblClt.s_getInstance().setValue(TblClt.STR_IDT_PRENOM1,
                this._pnlId_.getIdentitePrenom1());

        TblClt.s_getInstance().setValue(TblClt.STR_IDT_PRENOM2,
                this._pnlId_.getIdentitePrenom2());

        TblClt.s_getInstance().setValue(TblClt.STR_IDT_PRENOM3,
                this._pnlId_.getIdentitePrenom3());

        TblClt.s_getInstance().setValue(TblClt.STR_IDT_BIRTH,
                this._pnlId_.getIdentiteDateNaissance());

        TblClt.s_getInstance().setValue(TblClt.STR_IDT_SEXE,
                this._pnlId_.getIdentiteSexe());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_NUMERO,
                this._pnlAdr_.getAdresseNumero());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_VOIE,
                this._pnlAdr_.getAdresseVoie());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_LIGNE1,
                this._pnlAdr_.getAdresseLigne1());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_LIGNE2,
                this._pnlAdr_.getAdresseLigne2());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_CODE,
                this._pnlAdr_.getAdresseCode());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_VILLE,
                this._pnlAdr_.getAdresseVille());

        TblClt.s_getInstance().setValue(TblClt.STR_ADR_PAYS,
                this._pnlAdr_.getAdressePays());

        TblClt.s_getInstance().setValue(TblClt.STR_TRAVAIL_MAIL,
                this._pnlEml_.getTravailMail());

        TblClt.s_getInstance().setValue(TblClt.STR_TRAVAIL_FIXE,
                this._pnlEml_.getTravailFixe());

        TblClt.s_getInstance().setValue(TblClt.STR_TRAVAIL_PORTABLE,
                this._pnlEml_.getTravailPortable());

        TblClt.s_getInstance().setValue(TblClt.STR_PERSO_MAIL,
                this._pnlEml_.getPersonnelMail());

        TblClt.s_getInstance().setValue(TblClt.STR_PERSO_FIXE,
                this._pnlEml_.getPersonnelFixe());

        TblClt.s_getInstance().setValue(TblClt.STR_PERSO_PORTABLE,
                this._pnlEml_.getPersonnePortable());
    }

    private PnlIdtHmn _pnlId_;
    private PnlAdressePostale _pnlAdr_;
    private PnlEmail _pnlEml_;


}
